<template>
    <div>

        <ul>
            <li><button @click="comname = One">组件1</button></li>
            <li><button @click="comname = Two">组件2</button></li>
        </ul>
        <component :is="comname"></component>

    </div>
</template>

<script setup>
import One from '@/components/One.vue'
import Two from '@/components/Two.vue';
import { ref, shallowRef } from 'vue'
const comname = shallowRef('One')
comname.value = One
// console.log(comname);


</script>
<style scoped>

</style>